glyph_brush_draw_cache
Rasterization cache for ab_glyph used in glyph_brush.
- Manages a texture. Draws glyphs into it and provides texture rect lookup for glyphs.
- Automatic re-use & reordering when needed.
use DrawCache;
// build a cache with default settings
let mut draw_cache = builder.build;
// queue up some glyphs to store in the cache
for in glyphs
// process everything in the queue, rasterizing & uploading as necessary
draw_cache.cache_queued?;
// access a given glyph's texture position & pixel position for the texture quad
match draw_cache.rect_for
Example
See the draw_cache_guts example to see how it works (run it from the top level).
cargo run --example draw_cache_guts